import { Controller, Get, Inject } from '@nestjs/common';
// import { AppService } from './app.service';

@Controller()
export class AppController {
  // 这里自动注入 AppService
  constructor(
    @Inject('API_KEY')
    private apiKey: string,
    @Inject('Cat') private cat: { name: string; age: number },
    // private appService: AppService,
    @Inject('AppService') private appService,
  ) {}

  @Get()
  getHello(): string {
    // 在这里获取到值，并且返回
    return this.apiKey;
  }
  @Get('cat')
  getCat(): string {
    return `name:${this.cat.name} age:${this.cat.age}`;
  }
  @Get('msg')
  getMessage(): string {
    return this.appService.message();
  }
}
